package com.demo.modules.mq.redis.service;

import com.demo.common.redis.service.RedisService;
import com.demo.modules.mq.redis.RedisAnnouncementMessage;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * 消息生产者
 * @author Rog
 */
@Service
public class RedisMessageProducerService {

    @Autowired
    private RedisService redisService;

    private String queueKey="queue";

    public Long sendMessage(RedisAnnouncementMessage message) {
        System.out.println("发送了" + message);
        return redisService.redisTemplate.opsForList().leftPush(queueKey, message);
    }
}

